-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workers Assets Binding #656
base: main
Are you sure you want to change the base?
Conversation
[assets]
binding = "ASSETS"
directory = "./public/"
Edit: Resolved. The assets binding is working correctly, just not printing out. |
Sorry that you went in circles on this. I think this looks correct. Have you tried deploying your worker and testing that? I will see if I can reproduce the issue in local development. |
This worked locally for me. You do need to specify a dummy URL (I think all Fetchers behave this way). |
Ah, that was it. Adding |
Couple questions/feedback on this:
|
I think 1. may be a bug in For 2, I assume you are using the |
I'd love to see an |
I'm not sure why the tests are failing in the CI. Started happening after my first commit, which just added a single method to |
Can anyone review this? |
I'm no longer with Cloudflare, so I cannot approve. I think test failures are related to the Rust 1.82 issue here. We may need to pin the Rust version in our CI. Otherwise, I think this is a good test to add. I would like to see it also tested with |
closes #644
I went down a rabbit hole creating an entire new
Assets
env binding just to find out it's aFetcher
. In fact, you can use assets without this PR by just callingenv.get_binding::<Fetcher>("ASSETS")
.Testing:
npx wrangler dev
inworker-sandbox
/asset/test.txt
TEST
in browser/asset/doesnotexist.txt